home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Buyer 1997 August
/
Oasis demo.iso
/
Internet
/
Wincim
/
16bit
/
SCRIPTS.LIB
/
CSERVE.SCR
< prev
next >
Wrap
Text File
|
1996-09-23
|
8KB
|
387 lines
!
! Copyright (c) 1996
! by CompuServe Incorporated, Columbus, Ohio
!
! The information in this software is subject to change without
! notice and should not be construed as a commitment by CompuServe.
!
! CSERVE:
! Connect to CIS.
! First argument is %TRUE if direct connect and %FALSE otherwise
! Success: returns %Success
! Failure: saves error msg in %FailureMsg and returns %Failure
! or %Fatal (depending on severity).
!
!+V
! "3.9.1"
!-V
DirectConnect = Arg1;
Internet = 25;
ifndef %HostName = "CPS";
Plus = "+";
ifndef %WaitForPPP = "1";
Wait_Time = 100;
ifndef %Scanned = "";
Msg = "Connecting to CompuServe Network";
if %Network <> Internet goto NotInternet;
Msg = "Logging onto CompuServe . ";
define %HostName = "CISAGREE";
Wait_Time = 40;
NotInternet:
show Msg;
Tries = 7;
NothingSent = 0;
SecureTries = 3;
FirstTry = %TRUE;
FailStr = "";
Sent_Host_Name = %FALSE;
ifndef %X121Address = "";
ifndef %OKCmd = "";
ifndef %StopAtHost = "";
ifndef %AccountID = "";
ifndef %BreakChar = "#";
ifndef %MicroChallenge = "";
ifndef %App = "";
on cancel goto Return_Cancel;
Start_Connect:
if Tries = 0 goto CIS_Error;
Tries = Tries - 1;
Connect_Wait:
wait
"UIC:" goto Send_ETX,
"Host Name:" goto Send_Host_Name,
"User ID:" goto Send_ID,
"Password:" goto Send_Password,
"XPAD:" goto Send_XPAD,
"ITI:" goto Send_XPAD,
"? LOG" goto Process_Log_Msg,
"??LOG" goto Process_Log_Msg,
"% IPN" goto Process_IPX_Msg,
"? IPX" goto Process_IPX_Msg,
"? ICD" goto Process_Net_Msg,
"??ICD" goto Process_Net_Msg,
"RA:" goto Handle_Secure_Login,
"0, OFF):" goto Send_Baud_Rate,
%mdm_Failure goto CIS_No_Carrier
until Wait_Time;
if %Network <> Internet goto Send_Break;
Wait_Time = 200;
if not Sent_Host_Name goto Send_CR;
if NothingSent goto Send_CR;
NothingSent = 1;
goto Start_Connect;
Send_Break:
if not DirectConnect goto Send_CR;
sendm %BreakChar;
sendm %BreakChar;
sendm %BreakChar;
Send_CR:
NothingSent = 0;
send %CR;
goto Start_Connect;
Send_Baud_Rate:
send %BaudRate;
send "^M";
goto Connect_Wait;
Send_ETX:
send "^C";
goto Connect_Wait;
PPPRecover:
Sent_Host_Name = %FALSE;
Send_Host_Name:
define %State = 5;
if Arg2 goto No_Wait;
wait until 10;
No_Wait:
if Sent_Host_Name goto Reset_Host_Name;
Sent_Host_Name = %TRUE;
Wait_Time = 200;
if %StopAtHost = "1" goto Return_Success;
send %HostName & "^M";
if %StopAtHost = "" goto Connect_Wait;
goto Return_Success;
!
! Only send Host Name response on 1st, 3rd, & 5th attempts
! to guard against unintended double host name prompts resulting
! from sending "^M". On even attempts, eat the Host Name: prompt.
!
Reset_Host_Name:
Sent_Host_Name = %FALSE;
Tries = Tries - 1;
goto Connect_Wait;
Send_ID:
define %State = 6;
if %StopAtHost = "1" goto GetHost;
define %ErrorCode = 0;
if %App = "CID" goto No_Msg1;
show "Logging onto CompuServe . . ";
No_Msg1:
if %MicroChallenge = "" goto No_Secure_Login;
send Plus & %UserID & %LogonParams & "/INT:60 /secure:1^M";
Plus = "";
goto Connect_Wait;
No_Secure_Login:
send %UserID & %LogonParams & "/INT:60^M";
goto Connect_Wait;
GetHost:
send "/HOST^M";
exit %Success;
Send_Password:
define %State = 7;
if %MicroChallenge <> "" goto Secure_Failure;
send %Password & %CR;
goto Logon_Wait;
Secure_Failure:
define %FailureMsg = "Secure login failure, non-secure connect aborted";
define %ErrorCode = 37;
exit %Fatal;
Send_XPAD:
if %X121Address = "" goto Missing_XPAD;
send %X121Address & %CR;
goto Connect_Wait;
Missing_XPAD:
define %FailureMsg = "Missing X.121 address";
define %ErrorCode = 21;
exit %Fatal;
Logon_Wait:
wait
"Account ID:" goto Send_AccountID,
"CompuServe" goto Return_Success,
"^[[>" goto Return_Success,
"^F" goto Return_Success,
"? LOG" goto Process_Log_Msg,
"??LOG" goto Process_Log_Msg,
"? IPX" goto Process_IPX_Msg,
" NTW" goto Logon_Failure,
"? ICD" goto Process_Net_Msg,
"??ICD" goto Process_Net_Msg,
"800 Direct Dial access " goto Process_800,
"OK^M" goto Send_OK_Cmd,
"^[I" goto Send_Response,
"PPP:" goto Connect_PPP,
%mdm_Failure goto CIS_No_Carrier
until 300;
define %ErrorCode = 22;
goto CIS_Failure;
Connect_PPP:
if %App <> "CID" goto Logon_Wait;
if %WaitForPPP = "0" goto PPPDone;
PPPTries = 2;
RetryPPP:
if PPPTries = 0 goto Send_ETX;
wait
"Host Name:" goto PPPRecover,
"~" goto PPPDone,
%mdm_Failure goto CIS_No_Carrier
until 300;
send "^C";
PPPTries = PPPTries - 1;
goto RetryPPP;
PPPDone:
define %PPP = "1";
exit %Success;
Process_Log_Msg:
wait
"INE" goto Bad_ID,
"ISX" goto Bad_ID_Syntax,
"CAI" goto Cannot_Auto_Irun,
"SIL" goto System_Unavailable,
"SIU" goto System_Unavailable,
"SNA" goto System_Unavailable,
"STU" goto Check_User_ID,
"INS" goto Bad_ID_Syntax,
"UTL" goto Too_Many_Users
until 50;
FailStr = "Unable to connect to CompuServe host";
goto Scan_Error;
Process_IPX_Msg:
define %ErrorCode = 23;
FailStr = "InfoPlex is unavailable, try again later";
goto Scan_Error;
Process_Net_Msg:
define %GatewayFailure = 1;
define %ErrorCode = 31;
FailStr = "PPP connection failure, please try again";
Scan_Error:
wait
"^M" goto Found_Error
until 15;
goto Return_Fatal_Msg;
Found_Error:
if %Scanned = "" goto Return_Fatal_Msg;
FailStr = %Scanned;
goto Return_Fatal_Msg;
Send_AccountID:
send %AccountID & %CR;
goto Logon_Wait;
Too_Many_Users:
if Tries = 0 goto Users_Failure;
show "Simultaneous users exceeded, retrying...";
goto Start_Connect;
Users_Failure:
define %FailureMsg = "Simultaneous users exceeded";
define %ErrorCode = 29;
exit %Fatal;
Cannot_Auto_Irun:
define %FailureMsg = "Cannot Auto Irun HMI server";
exit %Fatal;
Bad_ID:
define %ErrorCode = 24;
FailStr = "Incorrect User ID or password";
goto Try_Again;
Bad_ID_Syntax:
define %ErrorCode = 25;
FailStr = "Incorrect User ID syntax";
Try_Again:
if not FirstTry goto CIS_Fatal;
send "^C";
FirstTry = %FALSE;
wait
"User ID" goto Send_ID,
%mdm_Failure goto CIS_No_Carrier
until 140;
goto CIS_Fatal;
System_Unavailable:
define %ErrorCode = 23;
FailStr = "The system is unavailable, try again later";
goto Scan_Error;
Check_User_ID:
define %ErrorCode = 26;
define %FailureMsg = "The system is unavailable, check User ID";
exit %Fatal;
Process_800:
wait
"is not" goto No_800,
"rates" goto Access_Rates
until 25;
goto Logon_Wait;
No_800:
define %FailureMsg = "800 Direct Dial access is not available on your account";
define %ErrorCode = 4;
exit %Fatal;
Access_Rates:
show "800 Direct Dial access rates now in effect";
goto Logon_Wait;
Logon_Failure:
define %ErrorCode = 27;
FailStr = "Remote is busy or unavailable";
goto Scan_Error;
Send_OK_Cmd:
if %OKCmd = "" goto Logon_Wait;
send %OKCmd & %CR;
goto Logon_Wait;
Send_Response:
define %State = 8;
sendi %ESCIResponse;
exit %Success;
CIS_Error:
define %ErrorCode = 20;
CIS_Failure:
if %Network <> Internet goto No_Retry;
if %ErrorCode = 34 goto No_Retry;
define %GatewayFailure = 1;
No_Retry:
if FailStr <> "" goto Return_Fail_Msg;
define %FailureMsg = "Unable to connect to CompuServe host";
exit %Failure;
CIS_No_Carrier:
define %ErrorCode = 28;
if FailStr <> "" goto Return_Fail_Msg;
define %FailureMsg = "Modem connection lost";
exit %Failure;
CIS_Fatal:
if FailStr <> "" goto Return_Fatal_Msg;
define %FailureMsg = "Unable to connect to CompuServe host";
exit %Fatal;
Return_Fail_Msg:
define %FailureMsg = FailStr;
exit %Failure;
Return_Fatal_Msg:
define %FailureMsg = FailStr;
exit %Fatal;
Return_Success:
define %State = 8;
exit %Success;
Return_Cancel:
exit %Cancel;
Handle_Secure_Login:
if %MicroChallenge = "" goto Connect_Wait;
call %Dir & "seclog.scr" () : FailCode;
if FailCode = 0 goto Logon_Wait;
if FailCode = 1 goto Return_Cancel;
if FailCode = 3 goto CIS_No_Carrier;
! Failure condition.
FailStr = %SecFailTemp;
SecureTries = SecureTries - 1;
if SecureTries = 0 goto CIS_Failure;
show %SecFailTemp & ", retrying...";
goto Start_Connect;